package com.cn.controller;

import com.cn.pojo.SysMenu;
import com.cn.response.Result;
import com.cn.service.SysMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * 功能描述: <br>
 *
 * @program: wx-nimi-bank
 * @description: 侧边菜单控制层
 * @author: Mr.TYJ
 * @create: 2022-05-26 16:07
 **/
@RestController
@CrossOrigin
@Slf4j
@Api(tags = "侧边菜单控制层")
@RequestMapping("/menu")
public class SysMenuController {

@Autowired
    private SysMenuService sysMenuService;

    @ApiModelProperty(value = "加载菜单树",notes = "获取所有菜单树，以及展开的子集d")
    @GetMapping("/tree")
    public Result tree(){
        //查询所有的菜单
        List<SysMenu> menuTree=sysMenuService.findMenuTree();
        return Result.ok().data("tree",menuTree);
    }

}
